package com.example.services;


import com.example.constans.TaoistsConstants;
import com.example.request.XiaoLiuRenRequest;
import com.example.util.Result;
import com.example.util.TaoistsXLRUtil;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;

@Service
public class TaoistsService {
    public Result getXiaoLiuRen(@RequestBody XiaoLiuRenRequest xiaoLiuRenRequest) {
        Result result = null;
        String qikeType = xiaoLiuRenRequest.getQikeType();
        if (TaoistsConstants.TIME_QIKE.equals(qikeType)) {
            result = TaoistsXLRUtil.timeQiKe(xiaoLiuRenRequest.getQikeTime());
        }
        if (TaoistsConstants.ONE_QIKE.equals(qikeType)) {
            result = TaoistsXLRUtil.oneQiKe(Integer.parseInt(xiaoLiuRenRequest.getNum1()));
        }
        if (TaoistsConstants.TWO_QIKE.equals(qikeType)) {
            result = TaoistsXLRUtil.twoQiKe(Integer.parseInt(xiaoLiuRenRequest.getNum1()), Integer.parseInt(xiaoLiuRenRequest.getNum2()));
        }
        if (TaoistsConstants.THREE_QIKE.equals(qikeType)) {
            result = TaoistsXLRUtil.threeQiKe(Integer.parseInt(xiaoLiuRenRequest.getNum1()), Integer.parseInt(xiaoLiuRenRequest.getNum2()), Integer.parseInt(xiaoLiuRenRequest.getNum3()));
        }
        return result;
    }
}
